//
//  PSIPPacket.m
//  PacketSniffer
//
//  Created by nark on 01/05/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "PSIPPacket.h"


@implementation PSIPPacket

@synthesize sourceIP;
@synthesize destinationIP;
@synthesize headerLength;
@synthesize totalLength;
@synthesize version;
@synthesize identification;
@synthesize fragmentFlags;
@synthesize fragmentOffset;
@synthesize timeToLive;
@synthesize protocol;
@synthesize checksum;




- (NSString *)description
{
    return [NSString stringWithFormat:@"IP Packet - %@ -> %@", 
			sourceIP, 
			destinationIP];
}

- (NSMutableDictionary *)properties {
	NSMutableDictionary *propertyDict = [[NSMutableDictionary alloc] init];
	
	[propertyDict setValue:[NSString stringWithFormat:@"%d", self.version]							
					forKey:@"IP Version"];
	
	[propertyDict setValue:self.sourceIP								
					forKey:@"Source IP"];
	
	[propertyDict setValue:self.destinationIP							
					forKey:@"Destination IP"];
	
	[propertyDict setValue:[NSString stringWithFormat:@"%d", self.headerLength]						
					forKey:@"Header Length"];
	
	[propertyDict setValue:[NSString stringWithFormat:@"%d", self.totalLength]						
					forKey:@"Total Length"];
	
	return propertyDict;
}

@end
